package com.dgw.error;

import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.WebRequest;

import java.util.Map;

/**
 * @program: spring-boot-web-restfulcrud
 * @description:
 * @author: Mr.Dai
 * @create: 2019-12-03 17:52
 **/
@Component
public class AppErrorAttribute extends DefaultErrorAttributes {
    @Override
    public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) {
        Map<String, Object> map = super.getErrorAttributes(webRequest, includeStackTrace);
        map.put("url","www.blogdgw.com");
        map.put("ext",webRequest.getAttribute("ext",0));
        // 禁止trace
        //map.put("trace","");
        return map;
    }
}
